package org.guegan.util.dircompare.swt;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Text;
import org.guegan.util.dircompare.main.MainModule;
import org.guegan.util.dircompare.main.ProgressionCallbackListener;
import org.guegan.util.dircompare.util.Factory;

public 	class ButtonActionListener extends AbstractActionListener {
	private String name;
	private ProgressionCallbackListener listener;
	
	public ButtonActionListener(String name, ProgressionCallbackListener listener, Text text) {
		super(text);
		this.name = name;
		this.listener = listener;
	}
	
	@Override
	public void handleEvent(Event event) {
		MainModule module = Factory.getBean(name);
		module.setListener(listener);
		module.execute();
		displayText(module.getTextOutput());
	}
}


